<template>
	<el-dialog :title="dialogTitle" :visible.sync="visible" width="560px" :close-on-click-modal="false">
		<el-form ref="form" :model="formData" :rules="formRules" label-width="110px" class="config_form_wrapper">
			<el-form-item label="测量技术名称" prop="name">
				<el-input v-model="formData.name" placeholder="请输入测量技术名称"></el-input>
			</el-form-item>
			<el-form-item label="测量技术描述" prop="content">
				<el-input type="textarea" v-model="formData.content" placeholder="请输入测量技术描述"></el-input>
			</el-form-item>
			<el-form-item label="排序" prop="sort">
				<el-input-number v-model="formData.sort" controls-position="right"></el-input-number>
			</el-form-item>
		</el-form>
		<template slot="footer">
			<el-button size="medium" @click="visible = false">取消</el-button>
			<el-button size="medium" type="primary" @click="handleSubmitForm">{{ dialogType }}</el-button>
		</template>
	</el-dialog>
</template>

<script>
import formMixins from '../formMixins';
export default {
	mixins: [formMixins],
	data() {
		return {
			formRules: {
				name: [{ required: true, message: '请输入测量技术名称', trigger: 'blur' }],
				content: [{ required: true, message: '请输入测量技术描述', trigger: 'blur' }]
			}
		};
	},
	computed: {
		dialogTitle() {
			return this.dialogType + '测量技术';
		}
	},
	methods: {
		//格式化表单参数
		formatFormParams() {
			let params = { ...this.formData, type: this.type };
			return params;
		}
	}
};
</script>

<style lang="scss" scoped>
.config_form_wrapper {
	flex: 1;
	padding: 10px 10px 0 0;
}
</style>
